using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            System.Text.StringBuilder siteRoot = new System.Text.StringBuilder();
            siteRoot.Append("http://");
            siteRoot.Append(Request.ServerVariables["Server_Name"]);
            if (Request.Url.Port != 80)
            {
                siteRoot.Append(":");
                siteRoot.Append(Request.Url.Port);
            }
            siteRoot.Append(Request.ApplicationPath);

            if (!siteRoot.ToString().EndsWith("/"))
                siteRoot.Append("/");

            flashMenu.Variables.Add("SiteRoot", siteRoot.ToString().Substring(0, siteRoot.ToString().Length - 1));

            string currentUrl;
            if (Page is Acms.AcmsControls.TemplatePage)
            {
                currentUrl = ((Acms.AcmsControls.TemplatePage)Page).CurrentUrl;
            }
            else
            {
                currentUrl = Request.AppRelativeCurrentExecutionFilePath;
            }
            flashMenu.Variables.Add("CurrentUrl", currentUrl);
        }
    }
}
